package com.anran.common.utils;

import lombok.experimental.UtilityClass;
import org.apache.commons.lang3.StringUtils;
import org.springframework.util.CollectionUtils;


import java.util.Collection;


@UtilityClass
public class VerifyUtil {

    public static String defaultIfObjectEmpty(Object obj,String str) {
        return obj == null|| obj.toString().isEmpty() ? str : obj.toString();
    }

    public static <T> boolean isEmpty(Collection<T> list) {
        if(CollectionUtils.isEmpty(list)) {
            return true;
        }
        return false;
    }

    public static <T> boolean isEmpty(String str) {
        if(StringUtils.isEmpty(str)){
            return true;
        }
        return false;
    }
}
